package _07_串;

import java.util.Arrays;


/**
 * https://leetcode-cn.com/problems/reverse-string/
 * @Author: haogege
 * @Date: 2021/9/19
 */
public class _344_反转字符串 {

    public static void main(String[] args) {
        char[] s = {'h','e','l','l','o'};
        reverseString(s);

        System.out.println(Arrays.toString(s));
    }


    public static void reverseString(char[] s) {
        int left = 0;
        int right = s.length - 1;
        while (left < right) {
            char temp = s[left];
            s[left++] = s[right];
            s[right--] = temp;
        }
    }

}
